[Q001] Is there some general-purpose compression tool
for binary data?
[Q002] How do you link binary files?
[Q003] Is it OK to make changes to startup routine
(crt0.s)?
[Q004] Can an H blank interrupt be used during a V blank?
[Q005] Can data be written in units of bytes from the CPU
to VRAM?
[Q006] I want to program with thumb code in C language and
arm code in assembly language, but what is the best way to link?
[Q007] Tell me about access speeds for ROM and RAM.
[Q008] When data is written to the two timer-related
registers (TM*D & TM*CNT) while the timer is operating, when do the new values become
effective?
[Q009] Can the timer be used to realize interrupts in
agreement with the H counter?
[Q010] When I use the system call LZ77UnCompVram (which
expands LZ77 compressed data in VRAM), the first 1byte of data changes!
[Q011] I want to write part of the program in assembly
code. What is the register configuration for calling the assembly routine?
[Q012] Is it basically OK to change around the source
programs supplied in .s (assembly code)?
[Q013] The emulator runs fine under emulator, but sometimes
it does not operate well when I burn a Flash Pak and try running it.
[Q014] The AGB has a CPU internal RAM and CPU external RAM.
Since these have different access speeds, I want to put the parts of tasks that need to be
fast into the internal RAM and the parts that don't need to be fast into the external RAM.
What is the best way to do that?
[Q015] I want to delete unnecessary characters from the LC
font DAT file in order to reduce its size. Will this conflict with User Condition (4)
"Modify"?
[Q016] I know that modifications of the LC font data are
prohibited, but is it alright to attach shadows, display with gradations or use another
process when the font data is expanded from ROM to VRAM?
[Q017] Can the screen be changed to normal when operating
in a CGB-compatible mode?
[Q018] How do I return from the STOP state with an SIO
interrupt?
[Q019] When I increase the capacity of the IRQ stack, the
system doesn't run correctly!
[Q020] Tell me about the order of priority for
interrupts.
[Q021] Do I need to update the emulator version when using
the Development AGB (TS4)? Also, if I update the emulator version, is there a problem
using the AGB Target Board (TS2)?
[Q022] Tell me about the data format registered in ROM.
[Q023] How does disabling the prefetch buffer flag affect
battery life?
Is there some general-purpose compression tool for binary data?
Please use agbcomp, which is included in the Developers Kit. For data decompression use HuffUnComp, ALZ77UnCompWram, RLUnCompWram, etc.
How do you link binary files?
Add the following descriptions to Makefile:
.BINFILES = filename.bin
.OFILES = $(.SFILES:.s=.o) $(.CFILES:.c=.o) $(.BINFILES:.bin=.o)
.SUFFIXES: .bin $(SUFFIXES)
.bin.o:
objcopy -v -I binary -O elf32-little $< $@
Is it OK to make changes to startup routine (crt0.s)?
What's contained in the SDK is a sample, so you are free to modify it.
Can an H blank interrupt be used during a V blank?
No, not according to the hardware specifications.
Can data be written in units of bytes from the CPU to VRAM?
Access is prohibited in anything other than the byte width described in [Section 2.2 Memory Structure and Access Width] of the AGB Programming Manual. Therefore, data can only be written in units of half-words (16 bits) to VRAM.
I want to program with thumb code in C language and arm code in assembly language, but what is the best way to link?
You already know about getting assembly code output to the compiler. But take a look at the startup part of crt0.s and the interrupt branch process, which both have a part where a thumb (16-bit) code instruction C language routine is called from an arm (32-bit) code instruction assembly routine (an arm (32-bit) code instruction C routine can also be called).
Tell me about access speeds for ROM and RAM.
The access speed of mask ROM for commercial-version Game Paks is 3-1 (3 wait
cycles/random access, 1 wait cycle/sequential access).
The CPU internal RAM is no-wait. (There is no sequential access).
The CPU external WRAM is the 2 wait of the 16bit data bus. (There is no sequential
access).
Access during DMA transfers involves repeated actions of reading followed by writing, so
the access time is the sum of the transfer source access time and transfer target access
time. So, for example, when the transfer source is the Game Pak's mask ROM and the
transfer target is CPU external WRAM, the duration of the read complies to the mask ROM's
2nd cycle access speed, and the duration of the write becomes the access speed of the CPU
external WRAM.
When data is written to the two timer-related registers (TM*D & TM*CNT) while the timer is operating, when do the new values become effective?
The value written to TM*D while the timer is operating is read into the counter when the timer has overflowed, but the value written to TM*CNT is reflected immediately upon being written.
Can the timer be used to realize interrupts in agreement with the H counter?
The delay of execution of interrupt routine after the interrupt has been generated can
vary by up to 10 clock cycles, depending on which instruction (or DMA) was executing at
the time the interrupt was generated.
If you consider that it is 4 clocks per dot, you can see it would be difficult with the
timer to get the timing down completely as planned.
Furthermore, since accessing LCD control registers during display can cause faulty
operations, we do not recommend this strategy.
When I use the system call LZ77UnCompVram (which expands LZ77 compressed data in VRAM), the first 1byte of data changes!
A bug has been identified in the LZ77UnCompVram system call of AGB Target Board (TS2). Please refrain from using this system call with TS2. The problem has been fixed for Development AGB (TS4).
I want to write part of the program in assembly code. What is the register configuration for calling the assembly routine?
R0 - R3 for function arguments, R0 for the return value. R0 - R3 and R12 can be used
without being saved in the stack area inside the function.
These rules were devised by ARM Ltd. in their ARM Procedure Call Standard (APCS) / Thumb
Procedure Call Standard (TPCS).
For further details, see http://www.cygnus.com/pubs/gnupro/6_embed/embARM.html
or http://www.arm.com/Documentation/ISTSpecs/ATPCSA05.pdf
These documents are also explained in "ARM System-on-Chip Architecture" (written
by S. Furber).
Is it basically OK to change around the source programs supplied in .s (assembly code)?
Yes, the source programs that come with the SDK are samples. You are free to change them at will.
The emulator runs fine under emulator, but sometimes it does not operate well when I burn a Flash Pak and try running it.
When you combine the target board with a Flash Pak, on extremely rare occasions noise can lead to faulty operations.
The AGB has CPU internal RAM and CPU external RAM. Since these have different access speeds, I want to put the parts of tasks that need to be fast into the internal RAM and the parts that don't need to be fast into the external RAM. What is the best way to do that?
Take a look at the linker script in the [overlay] sample included in the AGB Developer ToolKit. The variables have been divided into the .data section and the .bss section. This is based on whether or not they have an initial value. The variables are then allocated to CPU external RAM and CPU internal RAM, respectively.
I want to delete unnecessary characters from the LC Japanese font data file (*.DAT) in order to reduce its size. Will this conflict with User Condition (4) "Modify"?
User Condition (4) "Modify" refers to alterations of the font data. There is no problem if you want to extract only the necessary data from the DAT file to use it.
I know that modifications of the LC Japanese font data are prohibited, but is it alright to attach shadows, display with gradations or use another process when the font data is expanded from ROM into VRAM?
As long as the mask ROM contains the original LC font data, you can arrange the fonts at the time of display without a problem.
Can the screen be changed to normal when operating in CGB-compatible mode? (So the screen's "normal screen mode/wide-screen mode" function cannot be used.)
The screen cannot be changed to normal because the "normal screen mode/wide-screen mode" function is executed through the hardware.
How do I return from the STOP state with an SIO interrupt?
To return from the STOP state with an SIO interrupt, switch the SIO mode to the general-purpose communications mode.
When I increase the capacity of the IRQ stack, the system doesn't run correctly!
Check to see whether the user stack is clearing at the time of initialization.
Tell me about the order of priority for interrupts.
The order of priority for interrupts is determined by the relative order of the interrupt flags in the interrupt branch process (crt0.s). By altering the relative order here, you can freely modify the order of priority in interrupts. When multiple interrupts are employed, the last to arrive takes precedence.
Do I need to update the emulator version when using the Development AGB (TS4)? Also, if I update the emulator version, is there a problem using the AGB Target Board (TS2)?
If you are going to use the Development AGB (TS4), make sure you change to version I or later of the emulator. This is because with the G version of the emulator, the cartridge-shaped probe is for use with the CGB, so the AGB will not start up. Instead, a CGB will begin running. You can continue to use the AGB Target Board (TS2) with the I version and later of the IS-AGB-Emulator.
Tell me about the data format registered in ROM.
If you want to learn about the data format registered in ROM, please read ROM Registration Data (Section 18 in the AGB Programming Manual).
To what extent does disabling the prefetch buffer flag affect battery life?
Measurement results suggest that it is only within the error range of the overall system. Most likely, the difference would only be a few minutes. Using the system calls VBlankIntrWait() / IntrWait() / Halt () puts the system in a Halt state, decreasing the number of command fetches to the ROM area. Thus, the difference becomes even less.
D.C.N. AGB-06-0027-001A1 (2/21/01)
© 2001 Nintendo of America Inc.